<?php
/**
 * Created by PhpStorm.
 * User: lidan
 * Date: 2018/10/8
 * Time: 下午1:03
 */

namespace Imooc;

/**
 * 事件产生者
 * Class EventGenerator
 * @package Imooc
 */
abstract class EventGenerator
{
    private $observers = [];
    function addObserver(Observer $observer)
    {
        $this->observers[] = $observer;
    }

    function notify()
    {
        foreach ($this->observers as $observer){
            $observer->update();
        }
    }
}